using System;
using Tanker;

namespace Demo
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] ints = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            Sequence<int> nums = Sequence.Create(ints);
            Sequence<int> query = nums
                                    .Where(delegate(int i) { return i % 2 == 0; })
                                    .Select<int>(delegate(int i) { return i + i; });            
            query.ForEach(Console.WriteLine);

            Person p1 = new Person("Peijuin");
            Person p2 = new Person("Pranalan");
            Person p3 = new Person("Elvin");
            Person[] personArray = new Person[] {p1, p1, p2, p3};

            Sequence<Person> people = Sequence.Create(personArray);
            Sequence<Person> selectedPeople =  people
                                                .Where(delegate(Person p) { return p.Name.StartsWith("P"); });
            
            selectedPeople.ForEach(delegate(Person p) { Console.WriteLine(p.Name); });
        }

    }

    public class Person
    {
        private string name;

        public Person(string name)
        {
            this.name = name;
        }

        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }
    }
}
